package com.devp.wsdl.provider;


import com.alibaba.fastjson.JSON;
import com.devp.common.BaseResponse;
import com.devp.common.BpmAuditResultRequest;
import com.devp.common.SubmitProcessRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.jws.WebService;
import java.util.HashMap;
import java.util.Map;


/**
 * webservice 外部接口
 * endpointInterface不能随便配置
 * 这些参数都很重要
 *
 * @author yong.liu
 */
@WebService(name = "domInterface",
        targetNamespace = "http://provider.wsdl.devp.com",
        endpointInterface = "com.devp.wsdl.provider.DomInterface")
@Component
public class DomInterfaceImpl implements DomInterface {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    /**
     * 未登录获取header
     *
     * @return
     */
    public Map<String, Object> getHeader() {
        Map<String, Object> header = new HashMap<>();

        return header;
    }

    /**
     * 测试接口
     *
     * @param request
     * @return
     */
    @Override
    @ResponseBody
    public BaseResponse test(SubmitProcessRequest request) {
        logger.info("================ test call start ====================");
        logger.info(JSON.toJSONString(request));
        return new BaseResponse();
    }


    @Override
    @ResponseBody
    public BaseResponse bpmAuditResult(BpmAuditResultRequest request) {
        logger.info("---------- BPM TO DOM  PARAMS ------------");
        logger.info(JSON.toJSONString(request));
        return new BaseResponse();
    }


}
